﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace ControlExplorer
{
    public static class Session
    {
        public static void Navigated(Uri uri) 
        {
            Hisotry.Add(new SessionItem() { Info = uri });
        }

        public static void Executed(string actionName) 
        {
            Hisotry.Add(new SessionItem() { Info = actionName });
        }

        public static ObservableCollection<SessionItem> Hisotry = new ObservableCollection<SessionItem>(); 
    }

    public class SessionItem 
        : INotifyPropertyChanged
    {
        public SessionItem() 
        {
            Start = DateTime.Now;
        }

        private object _info;

        public object Info
        {
            get 
            { 
                return _info; 
            }
            set 
            { 
                _info = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("Info"));
            }
        }

        private DateTime _start;
        public DateTime Start
        {
            get 
            { 
                return _start; 
            }
            set 
            { 
                _start = value; 
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("Start"));
            }
        }
    
        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler  PropertyChanged;

        #endregion
    }
}
